package com.hns.can.master.entity;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.hns.can.common.entity.BaseEntity;
import com.hns.tool.pub.DateTool;
import com.hns.tool.pub.PubUtil;

/**
 * 故障报警实体
 * @author:Fisher
 * @email:zhuangcaijin@126.com
 * @version Revision 2.0.0
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "T_COMM_MFT_ALM")
public class CommMftAlmEntity extends BaseEntity implements java.io.Serializable {
    
    // Fields
    @Id
    @Column(name = "RCRD_ID")
    private String     rcrdId;
    @Column(name = "CORP_ID")
    private String     corpId;
    @Column(name = "ORGAN_ID")
    private String     organId;
    @Column(name = "LINE_ID")
    private String     lineId;
    @Column(name = "CAR_ID")
    private String     carId;
    @Column(name = "DRV_ID")
    private String     drvId;
    @Column(name = "RCRD_TIME")
    private String     rcrdTime;
    @Column(name = "RCRD_JRNL_NO")
    private String     rcrdJrnlNo;
    @Column(name = "EQMT_CODE")
    private String     eqmtCode;
    @Column(name = "LIC_PLT_NO")
    private String     licPltNo;
    @Column(name = "LINE_CODE")
    private String     lineCode;
    @Column(name = "ECU_MFT_CODE")
    private String     ecuMftCode;
    @Column(name = "UP_DN")
    private String     upDn;
    @Column(name = "PRVS_STN_NO")
    private String     prvsStnNo;
    @Column(name = "NEXT_STN_NO")
    private String     nextStnNo;
    @Column(name = "MFT_TYPE_CODE")
    private String     mftTypeCode;
    @Column(name = "MFT_ST")
    private String     mftSt;
    @Column(name = "MFT_OCCUR_TIME")
    private String     mftOccurTime;
    @Column(name = "MFT_RPA_TIME")
    private String     mftRpaTime;
    @Column(name = "BEGIN_LO_LGT")
    private BigDecimal     beginLoLgt;
    @Column(name = "BEGIN_LO_LTT")
    private BigDecimal     beginLoLtt;
    @Column(name = "BEGIN_LO_DRC")
    private BigDecimal beginLoDrc;
    @Column(name = "END_LO_DRC")
    private BigDecimal endLoDrc;
    @Column(name = "END_LO_LGT")
    private BigDecimal     endLoLgt;
    @Column(name = "END_LO_LTT")
    private BigDecimal     endLoLtt;
    @Column(name = "GEN_TIME")
    private Date  genTime;
    
    @Transient
    private BigDecimal  spdOfMotVhi;
    
    @Transient
    private BigDecimal  rtteSpd;
    
    @Column(name = "RESERVED_FIELD_1")
    private BigDecimal reservedField1;
    @Column(name = "RESERVED_FIELD_2")
    private BigDecimal reservedField2;
    @Column(name = "RESERVED_FIELD_3")
    private BigDecimal reservedField3;
    @Column(name = "RESERVED_FIELD_4")
    private BigDecimal reservedField4;
    @Column(name = "RESERVED_FIELD_5")
    private String     reservedField5;
    @Column(name = "RESERVED_FIELD_6")
    private String     reservedField6;
    @Column(name = "RESERVED_FIELD_7")
    private String     reservedField7;
    @Column(name = "RESERVED_FIELD_8")
    private String     reservedField8;
    
    @Transient
    private String    lineName;
    @Transient
    private String organName;
    @Transient
    private String ecuMftName;
    @Transient
    private BigDecimal lasting;//持续时间
    @Transient
    private String prevStn;//上一站
    @Transient
    private String nextStn;//下一站

    @Transient
    private String status;
    @Transient
    private String mftOccurDate;
    @Transient
    private String drvName;
    @Transient
    private String stnName;
    @Transient
    private String stnCd;
    
    @Transient
    private String beginStn;
    @Transient
    private String endStn;
    @Transient
    private String location;
    @Transient
    private String gpsDetailAdr;
    @Transient
    private String  detailAddr;
    
    @Transient
    private String mftGradeName;
    @Transient
    private String mftTypeName;
    @Transient
    private String mftClCode;
    @Transient
    private String tel;
    
    @Transient
    private String carInCd;
    
    @Transient
    private BigDecimal mftOccurFreq;

    @Transient
    private String mftDiscCode;
    // -------------------------------
    
    public static final String TABLENAME = "T_COMM_MFT_ALM";
    
    // -------------------------------------
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        
        CommMftAlmEntity other = (CommMftAlmEntity) obj;
        
        if ((PubUtil.isEmpty(this.corpId) && PubUtil.isNotEmpty(other.corpId)) || !this.corpId.equals(other.corpId)) {
            return false;
        }
        
        if ((PubUtil.isEmpty(this.eqmtCode) && PubUtil.isNotEmpty(other.eqmtCode)) || !this.eqmtCode.equals(other.eqmtCode)) {
            return false;
        }
        
        if ((PubUtil.isEmpty(this.rcrdTime) && PubUtil.isNotEmpty(other.rcrdTime)) || !this.rcrdTime.equals(other.rcrdTime)) {
            return false;
        }
        
        return true;
    }
    
    public String getRcrdId() {
        return this.rcrdId;
    }
    
    public void setRcrdId(String rcrdId) {
        this.rcrdId = rcrdId;
    }
    
    
    public String getCorpId() {
        return this.corpId;
    }
    
    public void setCorpId(String corpId) {
        this.corpId = corpId;
    }
    
    
    public String getOrganId() {
        return this.organId;
    }
    
    public void setOrganId(String organId) {
        this.organId = organId;
    }
    
    
    public String getLineId() {
        return this.lineId;
    }
    
    public void setLineId(String lineId) {
        this.lineId = lineId;
    }
    
    
    public String getCarId() {
        return this.carId;
    }
    
    public void setCarId(String carId) {
        this.carId = carId;
    }
    
    
    public String getDrvId() {
        return this.drvId;
    }
    
    public void setDrvId(String drvId) {
        this.drvId = drvId;
    }
    
    
    public String getRcrdTime() {
        return this.rcrdTime;
    }
    
    public void setRcrdTime(String rcrdTime) {
        this.rcrdTime = rcrdTime;
    }
    
    
    public String getRcrdJrnlNo() {
        return this.rcrdJrnlNo;
    }
    
    public void setRcrdJrnlNo(String rcrdJrnlNo) {
        this.rcrdJrnlNo = rcrdJrnlNo;
    }
    
    
    public String getEqmtCode() {
        return this.eqmtCode;
    }
    
    public void setEqmtCode(String eqmtCode) {
        this.eqmtCode = eqmtCode;
    }
    
    
    public String getLicPltNo() {
        return this.licPltNo;
    }
    
    public void setLicPltNo(String licPltNo) {
        this.licPltNo = licPltNo;
    }
    
    
    public String getLineCode() {
        return this.lineCode;
    }
    
    public void setLineCode(String lineCode) {
        this.lineCode = lineCode;
    }
    
    
    public String getEcuMftCode() {
        return this.ecuMftCode;
    }
    
    public void setEcuMftCode(String ecuMftCode) {
        this.ecuMftCode = ecuMftCode;
    }
    
    public String getUpDn() {
        return upDn;
    }

    public void setUpDn(String upDn) {
        this.upDn = upDn;
    }

    public String getPrvsStnNo() {
        return this.prvsStnNo;
    }
    
    public void setPrvsStnNo(String prvsStnNo) {
        this.prvsStnNo = prvsStnNo;
    }
    
    
    public String getNextStnNo() {
        return this.nextStnNo;
    }
    
    public void setNextStnNo(String nextStnNo) {
        this.nextStnNo = nextStnNo;
    }
    
    
    public String getMftTypeCode() {
        return this.mftTypeCode;
    }
    
    public void setMftTypeCode(String mftTypeCode) {
        this.mftTypeCode = mftTypeCode;
    }
    
    
    public String getMftSt() {
        return this.mftSt;
    }
    
    public void setMftSt(String mftSt) {
        this.mftSt = mftSt;
    }
    
    
    public String getMftOccurTime() {
        return this.mftOccurTime;
    }
    
    public void setMftOccurTime(String mftOccurTime) {
        this.mftOccurTime = mftOccurTime;
    }
    
    
    public String getMftRpaTime() {
        return this.mftRpaTime;
    }
    
    public void setMftRpaTime(String mftRpaTime) {
        this.mftRpaTime = mftRpaTime;
    }

    public BigDecimal getBeginLoLgt() {
        return beginLoLgt;
    }

    public void setBeginLoLgt(BigDecimal beginLoLgt) {
        this.beginLoLgt = beginLoLgt;
    }

    public BigDecimal getBeginLoLtt() {
        return beginLoLtt;
    }

    public void setBeginLoLtt(BigDecimal beginLoLtt) {
        this.beginLoLtt = beginLoLtt;
    }

    public BigDecimal getEndLoLgt() {
        return endLoLgt;
    }

    public void setEndLoLgt(BigDecimal endLoLgt) {
        this.endLoLgt = endLoLgt;
    }

    public BigDecimal getEndLoLtt() {
        return endLoLtt;
    }

    public void setEndLoLtt(BigDecimal endLoLtt) {
        this.endLoLtt = endLoLtt;
    }

    public Date getGenTime() {
        return this.genTime;
    }
    
    public void setGenTime(Date genTime) {
        this.genTime = genTime;
    }
    
    
    public BigDecimal getReservedField1() {
        return this.reservedField1;
    }
    
    public void setReservedField1(BigDecimal reservedField1) {
        this.reservedField1 = reservedField1;
    }
    
    
    public BigDecimal getReservedField2() {
        return this.reservedField2;
    }
    
    public void setReservedField2(BigDecimal reservedField2) {
        this.reservedField2 = reservedField2;
    }
    
    
    public BigDecimal getReservedField3() {
        return this.reservedField3;
    }
    
    public void setReservedField3(BigDecimal reservedField3) {
        this.reservedField3 = reservedField3;
    }
    
    
    public BigDecimal getReservedField4() {
        return this.reservedField4;
    }
    
    public void setReservedField4(BigDecimal reservedField4) {
        this.reservedField4 = reservedField4;
    }
    
    
    public String getReservedField5() {
        return this.reservedField5;
    }
    
    public void setReservedField5(String reservedField5) {
        this.reservedField5 = reservedField5;
    }
    
    
    public String getReservedField6() {
        return this.reservedField6;
    }
    
    public void setReservedField6(String reservedField6) {
        this.reservedField6 = reservedField6;
    }
    
    
    public String getReservedField7() {
        return this.reservedField7;
    }
    
    public void setReservedField7(String reservedField7) {
        this.reservedField7 = reservedField7;
    }
    
    
    public String getReservedField8() {
        return this.reservedField8;
    }
    
    public void setReservedField8(String reservedField8) {
        this.reservedField8 = reservedField8;
    }

    public String getLineName() {
        return lineName;
    }

    public void setLineName(String lineName) {
        this.lineName = lineName;
    }

    public String getOrganName() {
        return organName;
    }

    public void setOrganName(String organName) {
        this.organName = organName;
    }

    public String getEcuMftName() {
        if(PubUtil.isEmpty(ecuMftName)){
            return "未知节点";
        }else{
            return ecuMftName;
        }
    }

    public void setEcuMftName(String ecuMftName) {
        this.ecuMftName = ecuMftName;
    }

    public BigDecimal getLasting() {
        return lasting;
    }

    public void setLasting(BigDecimal lasting) {
        this.lasting = lasting;
    }

    public String getLocate() {
//        if(PubUtil.isEmpty(this.getPrvsStnNo()) || PubUtil.isEmpty(this.getNextStnNo())){
//            return "-";
//        }else{
//            return this.getPrvsStnNo()+"-"+this.getNextStnNo();
//        }
    	return this.getPrvsStnNo();
    }

    public String getDetailLocate(){
        if(PubUtil.isEmpty(this.getBeginLoLgt()) || PubUtil.isEmpty(this.getBeginLoLtt())){
            return "未知坐标";
        }else{
            return this.getBeginLoLgt()+"-"+this.getBeginLoLtt();
        }
    }
    
    public String getPrevStn() {
        return prevStn;
    }

    public void setPrevStn(String prevStn) {
        this.prevStn = prevStn;
    }

    public String getNextStn() {
        return nextStn;
    }

    public void setNextStn(String nextStn) {
        this.nextStn = nextStn;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getLastingDetail() {
        if(this.mftRpaTime != null){
            return DateTool.transformTimeForTimeUnit(this.getLasting(),"HH'MI'SS''");
        }else{
            return "-";
        }
    }

    public String getMftOccurDate() {
        return mftOccurDate;
    }

    public void setMftOccurDate(String mftOccurDate) {
        this.mftOccurDate = mftOccurDate;
    }

    public String getDrvName() {
        return drvName;
    }

    public void setDrvName(String drvName) {
        this.drvName = drvName;
    }

    public String getStnName() {
        return stnName;
    }

    public void setStnName(String stnName) {
        this.stnName = stnName;
    }

    public String getStnCd() {
        return stnCd;
    }

    public void setStnCd(String stnCd) {
        this.stnCd = stnCd;
    }

    public String getBeginStn() {
        return beginStn;
    }

    public void setBeginStn(String beginStn) {
        this.beginStn = beginStn;
    }

    public String getEndStn() {
        return endStn;
    }

    public void setEndStn(String endStn) {
        this.endStn = endStn;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public BigDecimal getBeginLoDrc() {
        return beginLoDrc;
    }

    public void setBeginLoDrc(BigDecimal beginLoDrc) {
        this.beginLoDrc = beginLoDrc;
    }

    public BigDecimal getEndLoDrc() {
        return endLoDrc;
    }

    public void setEndLoDrc(BigDecimal endLoDrc) {
        this.endLoDrc = endLoDrc;
    }

    public String getGpsDetailAdr() {
        if(PubUtil.isEmpty(gpsDetailAdr)){
            return this.getBeginLoLgt()+"-"+this.getBeginLoLtt();
        }else{
            return gpsDetailAdr;
        }
    }

    public void setGpsDetailAdr(String gpsDetailAdr) {
        this.gpsDetailAdr = gpsDetailAdr;
    }

    public String getDetailAddr() {
        return detailAddr;
    }

    public void setDetailAddr(String detailAddr) {
        this.detailAddr = detailAddr;
    }

    public BigDecimal getSpdOfMotVhi() {
        return spdOfMotVhi;
    }

    public void setSpdOfMotVhi(BigDecimal spdOfMotVhi) {
        this.spdOfMotVhi = spdOfMotVhi;
    }

    public BigDecimal getRtteSpd() {
        return rtteSpd;
    }

    public void setRtteSpd(BigDecimal rtteSpd) {
        this.rtteSpd = rtteSpd;
    }

    public String getMftGradeName() {
        if(PubUtil.isEmpty(mftGradeName)){
            return "未知级别";
        }else{
            return mftGradeName;
        }
    }
    public void setMftGradeName(String mftGradeName) {
        this.mftGradeName = mftGradeName;
    }
    public String getMftTypeName() {
        if(PubUtil.isEmpty(mftTypeName)){
            return "未知故障";
        }else{
            return mftTypeName;
        }
    }
    public void setMftTypeName(String mftTypeName) {
        this.mftTypeName = mftTypeName;
    }
    public String getOccurDate() {
        if(this.getRcrdTime()!=null){
            return this.getRcrdTime().substring(0, 10);
        }else{
            return "";
        }
    }
    public String getOccurTime() {
        if(this.getMftOccurTime()!=null){
            return this.getMftOccurTime().substring(11);
        }else{
            return "";
        }
    }
    public String getHandleTime() {
        if(this.getMftRpaTime()!=null){
            return this.getMftRpaTime().substring(11);
        }else{
            return "";
        }
    }

    public String getMftClCode() {
        return mftClCode;
    }

    public void setMftClCode(String mftClCode) {
        this.mftClCode = mftClCode;
    }

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getCarInCd() {
		return carInCd;
	}

	public void setCarInCd(String carInCd) {
		this.carInCd = carInCd;
	}

	public BigDecimal getMftOccurFreq() {
		return mftOccurFreq;
	}

	public void setMftOccurFreq(BigDecimal mftOccurFreq) {
		this.mftOccurFreq = mftOccurFreq;
	}

    public String getMftDiscCode() {
        return mftDiscCode;
    }

    public void setMftDiscCode(String mftDiscCode) {
        this.mftDiscCode = mftDiscCode;
    }
}
